package br.com.vti.sisp_sicrim.controller;

import java.util.Arrays;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Qualifier;

import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.Validator;
import br.com.crud4j.core.model.business.Business;
import br.com.crud4j.core.util.MessageResolver;
import br.com.crud4j.vraptor3.controller.ControllerImpl;
import br.com.vti.sisp_sicrim.model.entity.Estado;
import br.com.vti.sisp_sicrim.model.entity.FichaCriminal;
import br.com.vti.sisp_sicrim.model.entity.enums.EstadoCivil;
import br.com.vti.sisp_sicrim.model.entity.enums.GrauInstrucao;
import br.com.vti.sisp_sicrim.model.entity.enums.Nacionalidade;
import br.com.vti.sisp_sicrim.model.entity.enums.Religiao;
import br.com.vti.sisp_sicrim.model.entity.enums.Sexo;
import br.com.vti.sisp_sicrim.modelo.business.exception.EstadoException;
import br.com.vti.sisp_sicrim.modelo.business.exception.FichaCriminalException;

@Resource
@Path("/pages/fichaCriminal")
public class FichaCriminalController extends ControllerImpl<FichaCriminal, FichaCriminalException> {
	 
	private final Business<Estado, EstadoException> estadoBusiness;
	
	public FichaCriminalController(Result result, Validator validator,
			@Qualifier("fichaCriminalBusiness") Business<FichaCriminal, FichaCriminalException> entidadeBusiness,
			@Qualifier("estadoBusiness") Business<Estado, EstadoException> estadoBusiness,
			MessageResolver messageResolver) {
		super(result, validator, entidadeBusiness, messageResolver);
		this.estadoBusiness = estadoBusiness;
	}

	@PostConstruct
    protected void init() {
        include("sexoList", Arrays.asList(Sexo.values()));
        include("nacionalidadeList", Arrays.asList(Nacionalidade.values()));
        include("estadoCivilList", Arrays.asList(EstadoCivil.values()));
        include("escolaridadeList", Arrays.asList(GrauInstrucao.values()));
        include("religiaoList", Arrays.asList(Religiao.values()));
        include("religiaoList", Arrays.asList(Religiao.values()));
        include("estadoList", estadoBusiness.listar(null));
    }
	
}
